#pragma once 
#include<iostream>
#include<string>
#include<unordered_map>
#include<fstream>
using namespace std;
const string dictname="./dict.txt";
const string sep=":";
static bool split(string &s,string *part1,string*part2)
{
auto pos=s.find(sep);
if(pos==string::npos)return false;
*part1=s.substr(0,pos);
*part2=s.substr(pos+1);
return  true;

}
class Init
{
 public:
  Init()
  {
   ifstream in(dictname);
   if(!in.is_open())
   {
    cout<<"文件打开失败"<<endl;
    exit(1);
   
   }
   string line;
   while(getline(in,line)) 
      {
        string part1,part2;
        split(line,&part1,&part2);
        dict.insert({part1,part2});

      }
      
    in.close();

  }



  string tranlate(const string &key)
  {
  auto iter=dict.find(key);
  if(iter==dict.end())return "Unknow";
  else return iter->second;
  }
private:
unordered_map<string,string>dict;
};